home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / freeWAIS-sf-1.1 / ir / ustubs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  4.2 KB  |  172 lines

  1. /* WIDE AREA INFORMATION SERVER SOFTWARE    
  2.    No guarantees or restrictions.  See the readme file for the full standard 
  3.    disclaimer.  
  4.    4.14.90    Harry Morris, morris@think.com
  5. */
  6.  
  7. /* Copyright (c) CNIDR (see ../COPYRIGHT) */
  8.  
  9.  
  10. #ifndef lint
  11. static char *RCSid = "$Header: /usr/local/ls6/src+data/src/freeWAIS-sf/ir/RCS/ustubs.c,v 1.10 1994/12/13 18:52:45 pfeifer Exp $";
  12. #endif
  13.  
  14. /* Change log:
  15.  * $Log: ustubs.c,v $
  16.  * Revision 1.10  1994/12/13  18:52:45  pfeifer
  17.  * chip@chinacat.unicom.com (Chip Rosenthal) patches.
  18.  * Excluding the merge of libinv and libwais
  19.  *
  20.  * Revision 1.9  1994/09/07  13:29:22  pfeifer
  21.  * ctype is now included from cdialect.h after inclusion of string.h.
  22.  * Since ctype.h (the local version defines strcmp and friends, inclusion o
  23.  * of string.h after that caused probems
  24.  *
  25.  * Revision 1.8  1994/09/07  12:43:38  pfeifer
  26.  * added const str2 to memmove definitions
  27.  *
  28.  * Revision 1.7  1994/08/08  07:32:53  pfeifer
  29.  * Moved wais_log_file_name and waislogfile to cutil.[ch]
  30.  *
  31.  * Revision 1.6  1994/08/05  07:12:52  pfeifer
  32.  * Release beta 04
  33.  *
  34.  * Revision 1.4  1994/07/13  07:53:26  pfeifer
  35.  * beta 02
  36.  *
  37.  * Revision 1.3  1994/04/29  23:23:23  pfeifer
  38.  * ifdef'ed memmove/remove  for gcc 2.4.3
  39.  * ,
  40.  *
  41.  * Revision 1.2  1994/03/08  21:07:09  pfeifer
  42.  * Patchlevel 04
  43.  *
  44.  * Revision 1.1  1993/02/16  15:05:35  freewais
  45.  * Initial revision
  46.  *
  47.  * Revision 1.4  92/05/06  17:35:13  jonathan
  48.  * Modified some #if's for NeXT and Mach.
  49.  * 
  50.  * Revision 1.3  92/03/06  11:08:49  jonathan
  51.  * fixed incompatible return type error in HP version of getwd.  Thanks to
  52.  * cshotton@oac.hsc.uth.tmc.edu.
  53.  * 
  54.  * Revision 1.2  92/02/12  13:54:29  jonathan
  55.  * Added "$Log" so RCS will put the log message in the header
  56.  * 
  57.  * 
  58. */
  59.  
  60. /*----------------------------------------------------------------------*/
  61. /* stubs for silly non-ansi c compilers                                 */
  62. /*----------------------------------------------------------------------*/
  63.  
  64. #include "ustubs.h"
  65. #include "cutil.h" /* for substrcmp and NULL */
  66.  
  67. #ifndef HAVE_GETCWD
  68. char *getwd(pathname)
  69. char *pathname;
  70. {
  71.   return((char*)getcwd(pathname, MAX_FILENAME_LEN));
  72. }
  73. #endif 
  74.  
  75. #ifdef SYSV
  76. #include <prototypes.h> /* may be XENIX dependent! */
  77. #ifndef HAVE_GETCWD
  78. char *
  79. getwd(pathname)
  80. char *pathname;
  81. {
  82.   return(getcwd(pathname, MAX_FILENAME_LEN));
  83. }
  84. #endif /* HAVE_GETCWD */
  85. #endif /* def SYSV */
  86.  
  87. /*----------------------------------------------------------------------*/
  88.  
  89. #ifndef HAVE_MEMMOVE
  90. #ifndef ANSI_LIKE   /* memmove is an ANSI function not defined by K&R */
  91. #ifndef hpux /* but HP defines it */
  92. void*
  93. memmove(str1,str2,n)
  94. void* str1;
  95. const void* str2;
  96. size_t n;
  97. {
  98.   bcopy((char*)str2,(char*)str1,(long)n);
  99.   return(str1);
  100. }
  101. #endif /* ndef hpux */
  102.  
  103. #else /* ansi is defined */
  104.  
  105. #ifdef __GNUC__ /* we are ansi like, are we gcc */
  106.  
  107. #if !(defined(NeXT) || defined(Mach)) /* and we are not on a next ! */
  108.  
  109. void*
  110. memmove(str1,str2,n)
  111. void* str1;
  112. const void* str2;
  113. size_t n;
  114. {
  115.   bcopy((char*)str2,(char*)str1,(long)n);
  116.   return(str1);
  117. }
  118.  
  119. #endif /* not NeXT or Mach */
  120.  
  121. #endif /* __GNUC__ */
  122.  
  123. #endif /* else ndef ANSI_LIKE */
  124. #endif /* HAVE_MEMMOVE */
  125. /*----------------------------------------------------------------------*/
  126.  
  127. #ifndef ANSI_LIKE  
  128.  
  129. /* atoi is not defined k&r. copied from the book */
  130. long atol(s)
  131. char *s;
  132. {
  133.   long i, n, sign;
  134.   for(i=0; s[i]==' ' || s[i]== 'n' || s[i]=='t'; i++)
  135.     ;                /* skip white space */
  136.   sign = 1;
  137.   if (s[i] == '+' || s[i] == '-')
  138.     sign = (s[i++]=='+') ? 1 : -1;
  139.   for (n=0; s[i] >= '0' && s[i] <= '9'; i++)
  140.     n= 10 * n + s[i] - '0';
  141.   return(sign * n);
  142. }
  143.  
  144. /*----------------------------------------------------------------------*/
  145. #ifndef AUTOCONF
  146. char *strstr(src,sub)
  147. char *src;
  148. char *sub;
  149. {
  150.   /* this is a poor implementation until the ANSI version catches on */
  151.   char *ptr;
  152.   for(ptr = src; (long)ptr <= (long)src + strlen(src) - strlen(sub); ptr++){
  153.     if(substrcmp(ptr, sub))
  154.       return(ptr);
  155.   }
  156.   return(NULL);
  157. }
  158. #endif
  159. /*----------------------------------------------------------------------*/
  160. #ifndef HAVE_REMOVE
  161. int remove(filename)
  162. char *filename;
  163. {
  164.   return(unlink(filename));
  165. }
  166. #endif /* HAVE_REMOVE */
  167. /*----------------------------------------------------------------------*/
  168.  
  169. #endif /* ndef ANSI_LIKE */
  170.  
  171.  
  172.